package thread;

public class Demo17 {
    public static void main(String[] args) throws InterruptedException {
        Thread mainThread = Thread.currentThread();
        Thread t = new Thread(() -> {
            while (true) {
//                try {
//                    Thread.sleep(1000);
//                } catch (InterruptedException e) {
//                    throw new RuntimeException(e);
//                }
                System.out.println("main线程当前状态" + mainThread.getState());
            }
        });
        System.out.println(t.getState());

        t.start();
//        Thread.sleep(500);
//        System.out.println(t.getState());
        t.join();
    }
}
